package com.example.shopping.controller;

import com.example.shopping.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
@RequestMapping("/category")
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    @RequestMapping("")
    public String category(@RequestParam String opr, @RequestParam Integer id) {

        if(opr.equals("del")){
            //删除
            boolean isDelete = categoryService.delete(id);

        }
        return "redirect:/admin/category/list";
    }

}
